from fastmcp import FastMCP
from weather_script import Weather
from Logger import logger
d=datetime.datetime.now()
import datetime
T=d.strftime('%Y-%m-%d %H-%M-%S')
T_0=T+'_Weather_Data'+'.log'

mcp = FastMCP("Weather")

# API endpoint for QWeather API

WEATHER=Weather()

@mcp.tool()
# Function to fetch and display weather
async def Fetch_weather(longitude,latitude):
    """
    调取某地的天气情况

    Args:
        longitude:经度
        latitude:纬度
    """
    return WEATHER.fetch_weather(longitude,latitude)


@mcp.tool()
async def gaode(addr):
    """
    调取某地的经纬度
    Args:
        addr:地址名
    """
    return WEATHER.gaode(addr)

 
if __name__ == "__main__":
# Initialize and run the server
    mcp.run()
